/**
##############################################################################

DOCOMO Innovations, Inc.

Copyright © 2011 DOCOMO Innovations, Inc. All rights reserved.

 

Date of Preparation: 08/01/2011

Contact: kozat@docomoinnovations.com

 

All intellectual property rights related to this software are vested in DOCOMO Innovations.

DOCOMO Innovations is under no obligation to maintain or support the software.

Neither DOCOMO Innovations nor its employees are responsible for any damage or loss resulting from the use of the software.

##############################################################################
 */
package umich.infinity.proxy;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;

import umich.infinity.facebookconn.FacebookUpdateMonitor;
import umich.infinity.facebookconn.FacebookUploadReq;
import umich.infinity.facebookconn.FacebookUser;

public class SharedData {
	public Map<String, FacebookUser> fbUsers;
	public Map<String, Integer> userNotiMonitor;
	
	public CacheManager cacheManager;
	public LogManager logManager;
	
	public LinkedList<FacebookUploadReq> uploadQueue;
	
	FacebookUpdateMonitor fbUpdateMonitor;
	
	public long lastWakeupTime = 0;
	
	public void wakeupUpdateScheduler() {
		long curTime = System.currentTimeMillis();
		
		if (curTime - lastWakeupTime > Para.MinimumWakeupDelay) {
			fbUpdateMonitor.semaphore.release();
			lastWakeupTime = curTime;
		} 
//		synchronized (fbUpdateMonitor) {
//			fbUpdateMonitor.notifyAll();
//		}
	}
	
	public SharedData() {
		
		fbUsers = new HashMap<String, FacebookUser>();
		userNotiMonitor = new HashMap<String, Integer>();
		cacheManager = new CacheManager();
		logManager = new LogManager();
		uploadQueue = new LinkedList<FacebookUploadReq>();
	}	
}
